package com.firefly.dao.assembler.cms;

import com.firefly.dao.dao.cms.po.LinkTypePo;
import com.firefly.dao.dto.cms.LinkTypeDto;
import com.firefly.dao.vo.cms.LinkTypeVo;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;

/**
 * @description: 链接分类
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2022/12/20
 **/
@Component
public class LinkTypeAssembler {
    public List<LinkTypeVo> getListVo(List<LinkTypePo> list){
        List<LinkTypeVo> result = new ArrayList<>();
        list.forEach(item -> {
            LinkTypeVo tmp = new LinkTypeVo();
            tmp.setId(item.getId());
            tmp.setName(item.getName());
            result.add(tmp);
        });
        return result;
    }

    public LinkTypePo getPo(LinkTypeDto detail){
        LinkTypePo entity = new LinkTypePo();
        entity.setId(detail.getId());
        entity.setName(detail.getName());
        return entity;
    }

    public LinkTypeVo getVo(LinkTypePo entity){
        LinkTypeVo detail = new LinkTypeVo();
        detail.setId(entity.getId());
        detail.setName(entity.getName());
        return detail;
    }
}
